import logging

import redis


class Config(object):
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1/information11'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    REDIS_PORT = 6379
    REDIS_HOST = '127.0.0.1'

    SECRET_KEY = 'it'
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 3600


class ProductionConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.ERROR

    # 正式开发中, 还需要更改mysql/redis的数据库配置(测试/正式)
    # SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@177.13.1.1/information11'


class DevelopmentConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG
